package cn.zktr.Personnel.controllers.tanyali;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;

import cn.zktr.Personnel.model.service.tanyali.EmaTmService;

@Controller
public class EmaTmController {
	@Autowired
	private EmaTmService tmservice;
	
	@RequestMapping("tyl/tk-dan-shun-xin-zeng")
	public void demo1() {
	}
	/**
	 * 新增题目（选择题）
	 */
	@PostMapping("shunzheti")
	public void xingzeng(Integer tmid,String tk,String zsz,String nyd,String TIMU,String fs,String type,String DAAN) {
		tmservice.updateTM(tmid, tk, zsz, nyd, TIMU, fs, type, DAAN);
//		System.out.println(tmid+"???"+tk+"???"+zsz+"???"+nyd+"???"+TIMU+"???"+fs+"???"+type+"???"+DAAN);
	}
	
	
	/**
	 * @return 难易度（选择题字段）
	 */
	@RequestMapping("nanyidu")
	@ResponseBody
	public JSONArray nanyidu() {
		return tmservice.nanyiduselect();
	}
	
	/**
	 * @return 知识点（选择题字段）
	 */
	@RequestMapping("zhishidian")
	@ResponseBody
	public JSONArray zhishidian() {
		return tmservice.zhishidianselect();
	}
	
	/**
	 * @return 题库（选择题字段）
	 */
	@RequestMapping("tiku")
	@ResponseBody
	public JSONArray tiku() {
		return tmservice.tikuselect();
	}
	  
	/**
	 * @return 分数（选择题字段）
	 */
	@RequestMapping("fenshu")
	@ResponseBody
	public JSONArray fenshu() {
		return tmservice.fenshuselect();
	}
	
	/**
	 * @return 试题（选择题字段）
	 */
	@RequestMapping("shiti")
	@ResponseBody
	public JSONArray shiti() {
		return tmservice.shitiselect();
	}
	
	
	@RequestMapping("tyl/tk-zong-he-xin-zeng")
	public void demo2() {
	}
		  
	
	/**
	 * 试卷新增
	 */
	@PostMapping("shijuan")
  public void sjxingzeng(Integer empid,String mc,Integer zf) {
	 tmservice.updateSJ(empid, mc,zf);
	 System.out.println(empid+"11111"+mc+"1111"+zf);
	 
 }
	@PostMapping("tmshijuan")
	public void sjxingzengtm(Integer tmid) {
		 tmservice.updatetmSJ(tmid);
	//	 System.out.println("2"+tmid);
	}
	
	/**
	 * @return 试卷新增字段（试卷名称）
	 */
	@RequestMapping("shijuan2")
	@ResponseBody
	public JSONArray shijuan() {
		System.err.println("?");
		return tmservice.shijuanselect();
	}
	
	/**
	 * @return 试卷新增字段（出卷人）
	 */
	@RequestMapping("chujuanren")
	@ResponseBody
	public JSONArray chujuanren() {
		return tmservice.chujuanrenselect();
	}
	
	/**
	 * @return 试卷新增字段（时长）
	 */
	@RequestMapping("shichang")
	@ResponseBody
	public JSONArray shichang() {
		return tmservice.shichangselect();
	}
	
	/**
	 * @return 试卷新增字段（总分）
	 */
	@RequestMapping("zongfen")
	@ResponseBody
	public JSONArray zongfen() {
		return tmservice.zongfenselect();
	}
	/**
	 * 试卷新增字段
	 */
//	public void sjziduan(HttpSession session) {
//		session.setAttribute("nanyidu", tmservice.nanyiduselect());
//		session.setAttribute("zhishidian", tmservice.zhishidianselect());
//		session.setAttribute("tiku", tmservice.tikuselect());
//		session.setAttribute("shijuan", tmservice.shijuanselect());
//		session.setAttribute("chujuanren", tmservice.chujuanrenselect());
//		session.setAttribute("shichang", tmservice.shichangselect());
//		session.setAttribute("zongfen", tmservice.zongfenselect());
//	}
	
	@RequestMapping("tyl/shi-juan-xin-zeng")
	public void demo3() {
	}
	
}
